/*!
 *  Licensed Materials - Property of IBM
 *  5725-I43 (C) Copyright IBM Corp. 2011, 2014. All Rights Reserved.
 *  US Government Users Restricted Rights - Use, duplication or
 *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 *  IBM Mobile Cloud Services JavaScript SDK, v1.0.0.20140718-1253
 *
 */



// Define a global for use by Cordova
global = window;

// Global To handle name parameters based selection of require depending on runtime
// Load the Cordova Exec
try {	
	if (typeof(cordova) == 'object' && typeof(cordova.require) == 'function') {
		var exec = cordova.require("cordova/exec");
	}	
} catch (e) {
	console.log(e);
}	

// Generated by IBMBluemix SDK v0.6.18 - template: 'combined' 
// Combined template optimized with RequireJS/r.js v2.1.14 & almond.
(function (global, window){
  
var __isAMD = !!(typeof define === 'function' && define.amd),
    __isNode = (typeof exports === 'object'),
    __isWeb = !__isNode;

// as Vadim Eisenberg/Haifa/IBM said, we need to add the below line to make 
// this SDK works in Nitrogen.
__isAMD = false ;

  var __nodeRequire = (__isNode ? require :
      function(dep){
        throw new Error("IBMBluemix SDK detected missing dependency: '" + dep + "' - in a non-nodejs runtime. All it's binding variables were 'undefined'.")
      });
var bundleFactory = function(cordova, exec) {/**
 * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/almond for details
 */
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */

var requirejs, require, define;
(function (undef) {
    var main, req, makeMap, handlers,
        defined = {},
        waiting = {},
        config = {},
        defining = {},
        hasOwn = Object.prototype.hasOwnProperty,
        aps = [].slice,
        jsSuffixRegExp = /\.js$/;

    function hasProp(obj, prop) {
        return hasOwn.call(obj, prop);
    }

    /**
     * Given a relative module name, like ./something, normalize it to
     * a real name that can be mapped to a path.
     * @param {String} name the relative name
     * @param {String} baseName a real name that the name arg is relative
     * to.
     * @returns {String} normalized name
     */
    function normalize(name, baseName) {
        var nameParts, nameSegment, mapValue, foundMap, lastIndex,
            foundI, foundStarMap, starI, i, j, part,
            baseParts = baseName && baseName.split("/"),
            map = config.map,
            starMap = (map && map['*']) || {};

        //Adjust any relative paths.
        if (name && name.charAt(0) === ".") {
            //If have a base name, try to normalize against it,
            //otherwise, assume it is a top-level require that will
            //be relative to baseUrl in the end.
            if (baseName) {
                //Convert baseName to array, and lop off the last part,
                //so that . matches that "directory" and not name of the baseName's
                //module. For instance, baseName of "one/two/three", maps to
                //"one/two/three.js", but we want the directory, "one/two" for
                //this normalization.
                baseParts = baseParts.slice(0, baseParts.length - 1);
                name = name.split('/');
                lastIndex = name.length - 1;

                // Node .js allowance:
                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
                }

                name = baseParts.concat(name);

                //start trimDots
                for (i = 0; i < name.length; i += 1) {
                    part = name[i];
                    if (part === ".") {
                        name.splice(i, 1);
                        i -= 1;
                    } else if (part === "..") {
                        if (i === 1 && (name[2] === '..' || name[0] === '..')) {
                            //End of the line. Keep at least one non-dot
                            //path segment at the front so it can be mapped
                            //correctly to disk. Otherwise, there is likely
                            //no path mapping for a path starting with '..'.
                            //This can still fail, but catches the most reasonable
                            //uses of ..
                            break;
                        } else if (i > 0) {
                            name.splice(i - 1, 2);
                            i -= 2;
                        }
                    }
                }
                //end trimDots

                name = name.join("/");
            } else if (name.indexOf('./') === 0) {
                // No baseName, so this is ID is resolved relative
                // to baseUrl, pull off the leading dot.
                name = name.substring(2);
            }
        }

        //Apply map config if available.
        if ((baseParts || starMap) && map) {
            nameParts = name.split('/');

            for (i = nameParts.length; i > 0; i -= 1) {
                nameSegment = nameParts.slice(0, i).join("/");

                if (baseParts) {
                    //Find the longest baseName segment match in the config.
                    //So, do joins on the biggest to smallest lengths of baseParts.
                    for (j = baseParts.length; j > 0; j -= 1) {
                        mapValue = map[baseParts.slice(0, j).join('/')];

                        //baseName segment has  config, find if it has one for
                        //this name.
                        if (mapValue) {
                            mapValue = mapValue[nameSegment];
                            if (mapValue) {
                                //Match, update name to the new value.
                                foundMap = mapValue;
                                foundI = i;
                                break;
                            }
                        }
                    }
                }

                if (foundMap) {
                    break;
                }

                //Check for a star map match, but just hold on to it,
                //if there is a shorter segment match later in a matching
                //config, then favor over this star map.
                if (!foundStarMap && starMap && starMap[nameSegment]) {
                    foundStarMap = starMap[nameSegment];
                    starI = i;
                }
            }

            if (!foundMap && foundStarMap) {
                foundMap = foundStarMap;
                foundI = starI;
            }

            if (foundMap) {
                nameParts.splice(0, foundI, foundMap);
                name = nameParts.join('/');
            }
        }

        return name;
    }

    function makeRequire(relName, forceSync) {
        return function () {
            //A version of a require function that passes a moduleName
            //value for items that may need to
            //look up paths relative to the moduleName
            return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
        };
    }

    function makeNormalize(relName) {
        return function (name) {
            return normalize(name, relName);
        };
    }

    function makeLoad(depName) {
        return function (value) {
            defined[depName] = value;
        };
    }

    function callDep(name) {
        if (hasProp(waiting, name)) {
            var args = waiting[name];
            delete waiting[name];
            defining[name] = true;
            main.apply(undef, args);
        }

        if (!hasProp(defined, name) && !hasProp(defining, name)) {
            throw new Error('No ' + name);
        }
        return defined[name];
    }

    //Turns a plugin!resource to [plugin, resource]
    //with the plugin being undefined if the name
    //did not have a plugin prefix.
    function splitPrefix(name) {
        var prefix,
            index = name ? name.indexOf('!') : -1;
        if (index > -1) {
            prefix = name.substring(0, index);
            name = name.substring(index + 1, name.length);
        }
        return [prefix, name];
    }

    /**
     * Makes a name map, normalizing the name, and using a plugin
     * for normalization if necessary. Grabs a ref to plugin
     * too, as an optimization.
     */
    makeMap = function (name, relName) {
        var plugin,
            parts = splitPrefix(name),
            prefix = parts[0];

        name = parts[1];

        if (prefix) {
            prefix = normalize(prefix, relName);
            plugin = callDep(prefix);
        }

        //Normalize according
        if (prefix) {
            if (plugin && plugin.normalize) {
                name = plugin.normalize(name, makeNormalize(relName));
            } else {
                name = normalize(name, relName);
            }
        } else {
            name = normalize(name, relName);
            parts = splitPrefix(name);
            prefix = parts[0];
            name = parts[1];
            if (prefix) {
                plugin = callDep(prefix);
            }
        }

        //Using ridiculous property names for space reasons
        return {
            f: prefix ? prefix + '!' + name : name, //fullName
            n: name,
            pr: prefix,
            p: plugin
        };
    };

    function makeConfig(name) {
        return function () {
            return (config && config.config && config.config[name]) || {};
        };
    }

    handlers = {
        require: function (name) {
            return makeRequire(name);
        },
        exports: function (name) {
            var e = defined[name];
            if (typeof e !== 'undefined') {
                return e;
            } else {
                return (defined[name] = {});
            }
        },
        module: function (name) {
            return {
                id: name,
                uri: '',
                exports: defined[name],
                config: makeConfig(name)
            };
        }
    };

    main = function (name, deps, callback, relName) {
        var cjsModule, depName, ret, map, i,
            args = [],
            callbackType = typeof callback,
            usingExports;

        //Use name if no relName
        relName = relName || name;

        //Call the callback to define the module, if necessary.
        if (callbackType === 'undefined' || callbackType === 'function') {
            //Pull out the defined dependencies and pass the ordered
            //values to the callback.
            //Default to [require, exports, module] if no deps
            deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
            for (i = 0; i < deps.length; i += 1) {
                map = makeMap(deps[i], relName);
                depName = map.f;

                //Fast path CommonJS standard dependencies.
                if (depName === "require") {
                    args[i] = handlers.require(name);
                } else if (depName === "exports") {
                    //CommonJS module spec 1.1
                    args[i] = handlers.exports(name);
                    usingExports = true;
                } else if (depName === "module") {
                    //CommonJS module spec 1.1
                    cjsModule = args[i] = handlers.module(name);
                } else if (hasProp(defined, depName) ||
                           hasProp(waiting, depName) ||
                           hasProp(defining, depName)) {
                    args[i] = callDep(depName);
                } else if (map.p) {
                    map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
                    args[i] = defined[depName];
                } else {
                    throw new Error(name + ' missing ' + depName);
                }
            }

            ret = callback ? callback.apply(defined[name], args) : undefined;

            if (name) {
                //If setting exports via "module" is in play,
                //favor that over return value and exports. After that,
                //favor a non-undefined return value over exports use.
                if (cjsModule && cjsModule.exports !== undef &&
                        cjsModule.exports !== defined[name]) {
                    defined[name] = cjsModule.exports;
                } else if (ret !== undef || !usingExports) {
                    //Use the return value from the function.
                    defined[name] = ret;
                }
            }
        } else if (name) {
            //May just be an object definition for the module. Only
            //worry about defining if have a module name.
            defined[name] = callback;
        }
    };

    requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
        if (typeof deps === "string") {
            if (handlers[deps]) {
                //callback in this case is really relName
                return handlers[deps](callback);
            }
            //Just return the module wanted. In this scenario, the
            //deps arg is the module name, and second arg (if passed)
            //is just the relName.
            //Normalize module name, if it contains . or ..
            return callDep(makeMap(deps, callback).f);
        } else if (!deps.splice) {
            //deps is a config object, not an array.
            config = deps;
            if (config.deps) {
                req(config.deps, config.callback);
            }
            if (!callback) {
                return;
            }

            if (callback.splice) {
                //callback is an array, which means it is a dependency list.
                //Adjust args if there are dependencies
                deps = callback;
                callback = relName;
                relName = null;
            } else {
                deps = undef;
            }
        }

        //Support require(['a'])
        callback = callback || function () {};

        //If relName is a function, it is an errback handler,
        //so remove it.
        if (typeof relName === 'function') {
            relName = forceSync;
            forceSync = alt;
        }

        //Simulate async callback;
        if (forceSync) {
            main(undef, deps, callback, relName);
        } else {
            //Using a non-zero value because of concern for what old browsers
            //do, and latest browsers "upgrade" to 4 if lower value is used:
            //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
            //If want a value immediately, use require('id') instead -- something
            //that works in almond on the global level, but not guaranteed and
            //unlikely to work in other AMD implementations.
            setTimeout(function () {
                main(undef, deps, callback, relName);
            }, 4);
        }

        return req;
    };

    /**
     * Just drops the config on the floor, but returns req in case
     * the config return value is used.
     */
    req.config = function (cfg) {
        return req(cfg);
    };

    /**
     * Expose module registry for debugging and tooling
     */
    requirejs._defined = defined;

    define = function (name, deps, callback) {

        //This module may not have dependencies
        if (!deps.splice) {
            //deps is not an array, so probably means
            //an object literal or factory function for
            //the value. Adjust args.
            callback = deps;
            deps = [];
        }

        if (!hasProp(defined, name) && !hasProp(waiting, name)) {
            waiting[name] = [name, deps, callback];
        }
    };

    define.amd = {
        jQuery: true
    };
}());

define("almond", function(){});

define('ibm/mobile/lib/IBMUnderscore', ['require','exports','module'],function (require, exports, module) {
  var __umodule__ = (function (require, exports, module) {
  

var root = this;
  var previousUnderscore = root._;
  var breaker = {};
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
  var push = ArrayProto.push, slice = ArrayProto.slice, concat = ArrayProto.concat, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty;
  var nativeForEach = ArrayProto.forEach, nativeMap = ArrayProto.map, nativeReduce = ArrayProto.reduce, nativeReduceRight = ArrayProto.reduceRight, nativeFilter = ArrayProto.filter, nativeEvery = ArrayProto.every, nativeSome = ArrayProto.some, nativeIndexOf = ArrayProto.indexOf, nativeLastIndexOf = ArrayProto.lastIndexOf, nativeIsArray = Array.isArray, nativeKeys = Object.keys, nativeBind = FuncProto.bind;
  var _ = function (obj) {
    if (obj instanceof _)
      return obj;
    if (!(this instanceof _))
      return new _(obj);
    this._wrapped = obj;
  };
  if (typeof exports !== "undefined") {
    if (typeof module !== "undefined" && module.exports) {
      exports = module.exports = _;
    }
    exports._ = _;
  } else {
    root._ = _;
  }
  _.VERSION = "1.6.0";
  var each = _.each = _.forEach = function (obj, iterator, context) {
      if (obj == null)
        return obj;
      if (nativeForEach && obj.forEach === nativeForEach) {
        obj.forEach(iterator, context);
      } else if (obj.length === +obj.length) {
        for (var i = 0, length = obj.length; i < length; i++) {
          if (iterator.call(context, obj[i], i, obj) === breaker)
            return;
        }
      } else {
        var keys = _.keys(obj);
        for (var i = 0, length = keys.length; i < length; i++) {
          if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker)
            return;
        }
      }
      return obj;
    };
  _.map = _.collect = function (obj, iterator, context) {
    var results = [];
    if (obj == null)
      return results;
    if (nativeMap && obj.map === nativeMap)
      return obj.map(iterator, context);
    each(obj, function (value, index, list) {
      results.push(iterator.call(context, value, index, list));
    });
    return results;
  };
  var reduceError = "Reduce of empty array with no initial value";
  _.reduce = _.foldl = _.inject = function (obj, iterator, memo, context) {
    var initial = arguments.length > 2;
    if (obj == null)
      obj = [];
    if (nativeReduce && obj.reduce === nativeReduce) {
      if (context)
        iterator = _.bind(iterator, context);
      return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
    }
    each(obj, function (value, index, list) {
      if (!initial) {
        memo = value;
        initial = true;
      } else {
        memo = iterator.call(context, memo, value, index, list);
      }
    });
    if (!initial)
      throw new TypeError(reduceError);
    return memo;
  };
  _.reduceRight = _.foldr = function (obj, iterator, memo, context) {
    var initial = arguments.length > 2;
    if (obj == null)
      obj = [];
    if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
      if (context)
        iterator = _.bind(iterator, context);
      return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
    }
    var length = obj.length;
    if (length !== +length) {
      var keys = _.keys(obj);
      length = keys.length;
    }
    each(obj, function (value, index, list) {
      index = keys ? keys[--length] : --length;
      if (!initial) {
        memo = obj[index];
        initial = true;
      } else {
        memo = iterator.call(context, memo, obj[index], index, list);
      }
    });
    if (!initial)
      throw new TypeError(reduceError);
    return memo;
  };
  _.find = _.detect = function (obj, predicate, context) {
    var result;
    any(obj, function (value, index, list) {
      if (predicate.call(context, value, index, list)) {
        result = value;
        return true;
      }
    });
    return result;
  };
  _.filter = _.select = function (obj, predicate, context) {
    var results = [];
    if (obj == null)
      return results;
    if (nativeFilter && obj.filter === nativeFilter)
      return obj.filter(predicate, context);
    each(obj, function (value, index, list) {
      if (predicate.call(context, value, index, list))
        results.push(value);
    });
    return results;
  };
  _.reject = function (obj, predicate, context) {
    return _.filter(obj, function (value, index, list) {
      return !predicate.call(context, value, index, list);
    }, context);
  };
  _.every = _.all = function (obj, predicate, context) {
    predicate || (predicate = _.identity);
    var result = true;
    if (obj == null)
      return result;
    if (nativeEvery && obj.every === nativeEvery)
      return obj.every(predicate, context);
    each(obj, function (value, index, list) {
      if (!(result = result && predicate.call(context, value, index, list)))
        return breaker;
    });
    return !!result;
  };
  var any = _.some = _.any = function (obj, predicate, context) {
      predicate || (predicate = _.identity);
      var result = false;
      if (obj == null)
        return result;
      if (nativeSome && obj.some === nativeSome)
        return obj.some(predicate, context);
      each(obj, function (value, index, list) {
        if (result || (result = predicate.call(context, value, index, list)))
          return breaker;
      });
      return !!result;
    };
  _.contains = _.include = function (obj, target) {
    if (obj == null)
      return false;
    if (nativeIndexOf && obj.indexOf === nativeIndexOf)
      return obj.indexOf(target) != -1;
    return any(obj, function (value) {
      return value === target;
    });
  };
  _.invoke = function (obj, method) {
    var args = slice.call(arguments, 2);
    var isFunc = _.isFunction(method);
    return _.map(obj, function (value) {
      return (isFunc ? method : value[method]).apply(value, args);
    });
  };
  _.pluck = function (obj, key) {
    return _.map(obj, _.property(key));
  };
  _.where = function (obj, attrs) {
    return _.filter(obj, _.matches(attrs));
  };
  _.findWhere = function (obj, attrs) {
    return _.find(obj, _.matches(attrs));
  };
  _.max = function (obj, iterator, context) {
    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
      return Math.max.apply(Math, obj);
    }
    var result = -Infinity, lastComputed = -Infinity;
    each(obj, function (value, index, list) {
      var computed = iterator ? iterator.call(context, value, index, list) : value;
      if (computed > lastComputed) {
        result = value;
        lastComputed = computed;
      }
    });
    return result;
  };
  _.min = function (obj, iterator, context) {
    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
      return Math.min.apply(Math, obj);
    }
    var result = Infinity, lastComputed = Infinity;
    each(obj, function (value, index, list) {
      var computed = iterator ? iterator.call(context, value, index, list) : value;
      if (computed < lastComputed) {
        result = value;
        lastComputed = computed;
      }
    });
    return result;
  };
  _.shuffle = function (obj) {
    var rand;
    var index = 0;
    var shuffled = [];
    each(obj, function (value) {
      rand = _.random(index++);
      shuffled[index - 1] = shuffled[rand];
      shuffled[rand] = value;
    });
    return shuffled;
  };
  _.sample = function (obj, n, guard) {
    if (n == null || guard) {
      if (obj.length !== +obj.length)
        obj = _.values(obj);
      return obj[_.random(obj.length - 1)];
    }
    return _.shuffle(obj).slice(0, Math.max(0, n));
  };
  var lookupIterator = function (value) {
    if (value == null)
      return _.identity;
    if (_.isFunction(value))
      return value;
    return _.property(value);
  };
  _.sortBy = function (obj, iterator, context) {
    iterator = lookupIterator(iterator);
    return _.pluck(_.map(obj, function (value, index, list) {
      return {
        value: value,
        index: index,
        criteria: iterator.call(context, value, index, list)
      };
    }).sort(function (left, right) {
      var a = left.criteria;
      var b = right.criteria;
      if (a !== b) {
        if (a > b || a === void 0)
          return 1;
        if (a < b || b === void 0)
          return -1;
      }
      return left.index - right.index;
    }), "value");
  };
  var group = function (behavior) {
    return function (obj, iterator, context) {
      var result = {};
      iterator = lookupIterator(iterator);
      each(obj, function (value, index) {
        var key = iterator.call(context, value, index, obj);
        behavior(result, key, value);
      });
      return result;
    };
  };
  _.groupBy = group(function (result, key, value) {
    _.has(result, key) ? result[key].push(value) : result[key] = [value];
  });
  _.indexBy = group(function (result, key, value) {
    result[key] = value;
  });
  _.countBy = group(function (result, key) {
    _.has(result, key) ? result[key]++ : result[key] = 1;
  });
  _.sortedIndex = function (array, obj, iterator, context) {
    iterator = lookupIterator(iterator);
    var value = iterator.call(context, obj);
    var low = 0, high = array.length;
    while (low < high) {
      var mid = low + high >>> 1;
      iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
    }
    return low;
  };
  _.toArray = function (obj) {
    if (!obj)
      return [];
    if (_.isArray(obj))
      return slice.call(obj);
    if (obj.length === +obj.length)
      return _.map(obj, _.identity);
    return _.values(obj);
  };
  _.size = function (obj) {
    if (obj == null)
      return 0;
    return obj.length === +obj.length ? obj.length : _.keys(obj).length;
  };
  _.first = _.head = _.take = function (array, n, guard) {
    if (array == null)
      return void 0;
    if (n == null || guard)
      return array[0];
    if (n < 0)
      return [];
    return slice.call(array, 0, n);
  };
  _.initial = function (array, n, guard) {
    return slice.call(array, 0, array.length - (n == null || guard ? 1 : n));
  };
  _.last = function (array, n, guard) {
    if (array == null)
      return void 0;
    if (n == null || guard)
      return array[array.length - 1];
    return slice.call(array, Math.max(array.length - n, 0));
  };
  _.rest = _.tail = _.drop = function (array, n, guard) {
    return slice.call(array, n == null || guard ? 1 : n);
  };
  _.compact = function (array) {
    return _.filter(array, _.identity);
  };
  var flatten = function (input, shallow, output) {
    if (shallow && _.every(input, _.isArray)) {
      return concat.apply(output, input);
    }
    each(input, function (value) {
      if (_.isArray(value) || _.isArguments(value)) {
        shallow ? push.apply(output, value) : flatten(value, shallow, output);
      } else {
        output.push(value);
      }
    });
    return output;
  };
  _.flatten = function (array, shallow) {
    return flatten(array, shallow, []);
  };
  _.without = function (array) {
    return _.difference(array, slice.call(arguments, 1));
  };
  _.partition = function (array, predicate) {
    var pass = [], fail = [];
    each(array, function (elem) {
      (predicate(elem) ? pass : fail).push(elem);
    });
    return [
      pass,
      fail
    ];
  };
  _.uniq = _.unique = function (array, isSorted, iterator, context) {
    if (_.isFunction(isSorted)) {
      context = iterator;
      iterator = isSorted;
      isSorted = false;
    }
    var initial = iterator ? _.map(array, iterator, context) : array;
    var results = [];
    var seen = [];
    each(initial, function (value, index) {
      if (isSorted ? !index || seen[seen.length - 1] !== value : !_.contains(seen, value)) {
        seen.push(value);
        results.push(array[index]);
      }
    });
    return results;
  };
  _.union = function () {
    return _.uniq(_.flatten(arguments, true));
  };
  _.intersection = function (array) {
    var rest = slice.call(arguments, 1);
    return _.filter(_.uniq(array), function (item) {
      return _.every(rest, function (other) {
        return _.contains(other, item);
      });
    });
  };
  _.difference = function (array) {
    var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
    return _.filter(array, function (value) {
      return !_.contains(rest, value);
    });
  };
  _.zip = function () {
    var length = _.max(_.pluck(arguments, "length").concat(0));
    var results = new Array(length);
    for (var i = 0; i < length; i++) {
      results[i] = _.pluck(arguments, "" + i);
    }
    return results;
  };
  _.object = function (list, values) {
    if (list == null)
      return {};
    var result = {};
    for (var i = 0, length = list.length; i < length; i++) {
      if (values) {
        result[list[i]] = values[i];
      } else {
        result[list[i][0]] = list[i][1];
      }
    }
    return result;
  };
  _.indexOf = function (array, item, isSorted) {
    if (array == null)
      return -1;
    var i = 0, length = array.length;
    if (isSorted) {
      if (typeof isSorted == "number") {
        i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
      } else {
        i = _.sortedIndex(array, item);
        return array[i] === item ? i : -1;
      }
    }
    if (nativeIndexOf && array.indexOf === nativeIndexOf)
      return array.indexOf(item, isSorted);
    for (; i < length; i++)
      if (array[i] === item)
        return i;
    return -1;
  };
  _.lastIndexOf = function (array, item, from) {
    if (array == null)
      return -1;
    var hasIndex = from != null;
    if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
      return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
    }
    var i = hasIndex ? from : array.length;
    while (i--)
      if (array[i] === item)
        return i;
    return -1;
  };
  _.range = function (start, stop, step) {
    if (arguments.length <= 1) {
      stop = start || 0;
      start = 0;
    }
    step = arguments[2] || 1;
    var length = Math.max(Math.ceil((stop - start) / step), 0);
    var idx = 0;
    var range = new Array(length);
    while (idx < length) {
      range[idx++] = start;
      start += step;
    }
    return range;
  };
  var ctor = function () {
  };
  _.bind = function (func, context) {
    var args, bound;
    if (nativeBind && func.bind === nativeBind)
      return nativeBind.apply(func, slice.call(arguments, 1));
    if (!_.isFunction(func))
      throw new TypeError();
    args = slice.call(arguments, 2);
    return bound = function () {
      if (!(this instanceof bound))
        return func.apply(context, args.concat(slice.call(arguments)));
      ctor.prototype = func.prototype;
      var self = new ctor();
      ctor.prototype = null;
      var result = func.apply(self, args.concat(slice.call(arguments)));
      if (Object(result) === result)
        return result;
      return self;
    };
  };
  _.partial = function (func) {
    var boundArgs = slice.call(arguments, 1);
    return function () {
      var position = 0;
      var args = boundArgs.slice();
      for (var i = 0, length = args.length; i < length; i++) {
        if (args[i] === _)
          args[i] = arguments[position++];
      }
      while (position < arguments.length)
        args.push(arguments[position++]);
      return func.apply(this, args);
    };
  };
  _.bindAll = function (obj) {
    var funcs = slice.call(arguments, 1);
    if (funcs.length === 0)
      throw new Error("bindAll must be passed function names");
    each(funcs, function (f) {
      obj[f] = _.bind(obj[f], obj);
    });
    return obj;
  };
  _.memoize = function (func, hasher) {
    var memo = {};
    hasher || (hasher = _.identity);
    return function () {
      var key = hasher.apply(this, arguments);
      return _.has(memo, key) ? memo[key] : memo[key] = func.apply(this, arguments);
    };
  };
  _.delay = function (func, wait) {
    var args = slice.call(arguments, 2);
    return setTimeout(function () {
      return func.apply(null, args);
    }, wait);
  };
  _.defer = function (func) {
    return _.delay.apply(_, [
      func,
      1
    ].concat(slice.call(arguments, 1)));
  };
  _.throttle = function (func, wait, options) {
    var context, args, result;
    var timeout = null;
    var previous = 0;
    options || (options = {});
    var later = function () {
      previous = options.leading === false ? 0 : _.now();
      timeout = null;
      result = func.apply(context, args);
      context = args = null;
    };
    return function () {
      var now = _.now();
      if (!previous && options.leading === false)
        previous = now;
      var remaining = wait - (now - previous);
      context = this;
      args = arguments;
      if (remaining <= 0) {
        clearTimeout(timeout);
        timeout = null;
        previous = now;
        result = func.apply(context, args);
        context = args = null;
      } else if (!timeout && options.trailing !== false) {
        timeout = setTimeout(later, remaining);
      }
      return result;
    };
  };
  _.debounce = function (func, wait, immediate) {
    var timeout, args, context, timestamp, result;
    var later = function () {
      var last = _.now() - timestamp;
      if (last < wait) {
        timeout = setTimeout(later, wait - last);
      } else {
        timeout = null;
        if (!immediate) {
          result = func.apply(context, args);
          context = args = null;
        }
      }
    };
    return function () {
      context = this;
      args = arguments;
      timestamp = _.now();
      var callNow = immediate && !timeout;
      if (!timeout) {
        timeout = setTimeout(later, wait);
      }
      if (callNow) {
        result = func.apply(context, args);
        context = args = null;
      }
      return result;
    };
  };
  _.once = function (func) {
    var ran = false, memo;
    return function () {
      if (ran)
        return memo;
      ran = true;
      memo = func.apply(this, arguments);
      func = null;
      return memo;
    };
  };
  _.wrap = function (func, wrapper) {
    return _.partial(wrapper, func);
  };
  _.compose = function () {
    var funcs = arguments;
    return function () {
      var args = arguments;
      for (var i = funcs.length - 1; i >= 0; i--) {
        args = [funcs[i].apply(this, args)];
      }
      return args[0];
    };
  };
  _.after = function (times, func) {
    return function () {
      if (--times < 1) {
        return func.apply(this, arguments);
      }
    };
  };
  _.keys = function (obj) {
    if (!_.isObject(obj))
      return [];
    if (nativeKeys)
      return nativeKeys(obj);
    var keys = [];
    for (var key in obj)
      if (_.has(obj, key))
        keys.push(key);
    return keys;
  };
  _.values = function (obj) {
    var keys = _.keys(obj);
    var length = keys.length;
    var values = new Array(length);
    for (var i = 0; i < length; i++) {
      values[i] = obj[keys[i]];
    }
    return values;
  };
  _.pairs = function (obj) {
    var keys = _.keys(obj);
    var length = keys.length;
    var pairs = new Array(length);
    for (var i = 0; i < length; i++) {
      pairs[i] = [
        keys[i],
        obj[keys[i]]
      ];
    }
    return pairs;
  };
  _.invert = function (obj) {
    var result = {};
    var keys = _.keys(obj);
    for (var i = 0, length = keys.length; i < length; i++) {
      result[obj[keys[i]]] = keys[i];
    }
    return result;
  };
  _.functions = _.methods = function (obj) {
    var names = [];
    for (var key in obj) {
      if (_.isFunction(obj[key]))
        names.push(key);
    }
    return names.sort();
  };
  _.extend = function (obj) {
    each(slice.call(arguments, 1), function (source) {
      if (source) {
        for (var prop in source) {
          obj[prop] = source[prop];
        }
      }
    });
    return obj;
  };
  _.pick = function (obj) {
    var copy = {};
    var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
    each(keys, function (key) {
      if (key in obj)
        copy[key] = obj[key];
    });
    return copy;
  };
  _.omit = function (obj) {
    var copy = {};
    var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
    for (var key in obj) {
      if (!_.contains(keys, key))
        copy[key] = obj[key];
    }
    return copy;
  };
  _.defaults = function (obj) {
    each(slice.call(arguments, 1), function (source) {
      if (source) {
        for (var prop in source) {
          if (obj[prop] === void 0)
            obj[prop] = source[prop];
        }
      }
    });
    return obj;
  };
  _.clone = function (obj) {
    if (!_.isObject(obj))
      return obj;
    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
  };
  _.tap = function (obj, interceptor) {
    interceptor(obj);
    return obj;
  };
  var eq = function (a, b, aStack, bStack) {
    if (a === b)
      return a !== 0 || 1 / a == 1 / b;
    if (a == null || b == null)
      return a === b;
    if (a instanceof _)
      a = a._wrapped;
    if (b instanceof _)
      b = b._wrapped;
    var className = toString.call(a);
    if (className != toString.call(b))
      return false;
    switch (className) {
    case "[object String]":
      return a == String(b);
    case "[object Number]":
      return a != +a ? b != +b : a == 0 ? 1 / a == 1 / b : a == +b;
    case "[object Date]":
    case "[object Boolean]":
      return +a == +b;
    case "[object RegExp]":
      return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase;
    }
    if (typeof a != "object" || typeof b != "object")
      return false;
    var length = aStack.length;
    while (length--) {
      if (aStack[length] == a)
        return bStack[length] == b;
    }
    var aCtor = a.constructor, bCtor = b.constructor;
    if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && _.isFunction(bCtor) && bCtor instanceof bCtor) && ("constructor" in a && "constructor" in b)) {
      return false;
    }
    aStack.push(a);
    bStack.push(b);
    var size = 0, result = true;
    if (className == "[object Array]") {
      size = a.length;
      result = size == b.length;
      if (result) {
        while (size--) {
          if (!(result = eq(a[size], b[size], aStack, bStack)))
            break;
        }
      }
    } else {
      for (var key in a) {
        if (_.has(a, key)) {
          size++;
          if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack)))
            break;
        }
      }
      if (result) {
        for (key in b) {
          if (_.has(b, key) && !size--)
            break;
        }
        result = !size;
      }
    }
    aStack.pop();
    bStack.pop();
    return result;
  };
  _.isEqual = function (a, b) {
    return eq(a, b, [], []);
  };
  _.isEmpty = function (obj) {
    if (obj == null)
      return true;
    if (_.isArray(obj) || _.isString(obj))
      return obj.length === 0;
    for (var key in obj)
      if (_.has(obj, key))
        return false;
    return true;
  };
  _.isElement = function (obj) {
    return !!(obj && obj.nodeType === 1);
  };
  _.isArray = nativeIsArray || function (obj) {
    return toString.call(obj) == "[object Array]";
  };
  _.isObject = function (obj) {
    return obj === Object(obj);
  };
  each([
    "Arguments",
    "Function",
    "String",
    "Number",
    "Date",
    "RegExp"
  ], function (name) {
    _["is" + name] = function (obj) {
      return toString.call(obj) == "[object " + name + "]";
    };
  });
  if (!_.isArguments(arguments)) {
    _.isArguments = function (obj) {
      return !!(obj && _.has(obj, "callee"));
    };
  }
  if (typeof /./ !== "function") {
    _.isFunction = function (obj) {
      return typeof obj === "function";
    };
  }
  _.isFinite = function (obj) {
    return isFinite(obj) && !isNaN(parseFloat(obj));
  };
  _.isNaN = function (obj) {
    return _.isNumber(obj) && obj != +obj;
  };
  _.isBoolean = function (obj) {
    return obj === true || obj === false || toString.call(obj) == "[object Boolean]";
  };
  _.isNull = function (obj) {
    return obj === null;
  };
  _.isUndefined = function (obj) {
    return obj === void 0;
  };
  _.has = function (obj, key) {
    return hasOwnProperty.call(obj, key);
  };
  _.noConflict = function () {
    root._ = previousUnderscore;
    return this;
  };
  _.identity = function (value) {
    return value;
  };
  _.constant = function (value) {
    return function () {
      return value;
    };
  };
  _.property = function (key) {
    return function (obj) {
      return obj[key];
    };
  };
  _.matches = function (attrs) {
    return function (obj) {
      if (obj === attrs)
        return true;
      for (var key in attrs) {
        if (attrs[key] !== obj[key])
          return false;
      }
      return true;
    };
  };
  _.times = function (n, iterator, context) {
    var accum = Array(Math.max(0, n));
    for (var i = 0; i < n; i++)
      accum[i] = iterator.call(context, i);
    return accum;
  };
  _.random = function (min, max) {
    if (max == null) {
      max = min;
      min = 0;
    }
    return min + Math.floor(Math.random() * (max - min + 1));
  };
  _.now = Date.now || function () {
    return new Date().getTime();
  };
  var entityMap = {
      escape: {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        "\"": "&quot;",
        "'": "&#x27;"
      }
    };
  entityMap.unescape = _.invert(entityMap.escape);
  var entityRegexes = {
      escape: new RegExp("[" + _.keys(entityMap.escape).join("") + "]", "g"),
      unescape: new RegExp("(" + _.keys(entityMap.unescape).join("|") + ")", "g")
    };
  _.each([
    "escape",
    "unescape"
  ], function (method) {
    _[method] = function (string) {
      if (string == null)
        return "";
      return ("" + string).replace(entityRegexes[method], function (match) {
        return entityMap[method][match];
      });
    };
  });
  _.result = function (object, property) {
    if (object == null)
      return void 0;
    var value = object[property];
    return _.isFunction(value) ? value.call(object) : value;
  };
  _.mixin = function (obj) {
    each(_.functions(obj), function (name) {
      var func = _[name] = obj[name];
      _.prototype[name] = function () {
        var args = [this._wrapped];
        push.apply(args, arguments);
        return result.call(this, func.apply(_, args));
      };
    });
  };
  var idCounter = 0;
  _.uniqueId = function (prefix) {
    var id = ++idCounter + "";
    return prefix ? prefix + id : id;
  };
  _.templateSettings = {
    evaluate: /<%([\s\S]+?)%>/g,
    interpolate: /<%=([\s\S]+?)%>/g,
    escape: /<%-([\s\S]+?)%>/g
  };
  var noMatch = /(.)^/;
  var escapes = {
      "'": "'",
      "\\": "\\",
      "\r": "r",
      "\n": "n",
      "	": "t",
      "\u2028": "u2028",
      "\u2029": "u2029"
    };
  var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
  _.template = function (text, data, settings) {
    var render;
    settings = _.defaults({}, settings, _.templateSettings);
    var matcher = new RegExp([
        (settings.escape || noMatch).source,
        (settings.interpolate || noMatch).source,
        (settings.evaluate || noMatch).source
      ].join("|") + "|$", "g");
    var index = 0;
    var source = "__p+='";
    text.replace(matcher, function (match, escape, interpolate, evaluate, offset) {
      source += text.slice(index, offset).replace(escaper, function (match) {
        return "\\" + escapes[match];
      });
      if (escape) {
        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
      }
      if (interpolate) {
        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
      }
      if (evaluate) {
        source += "';\n" + evaluate + "\n__p+='";
      }
      index = offset + match.length;
      return match;
    });
    source += "';\n";
    if (!settings.variable)
      source = "with(obj||{}){\n" + source + "}\n";
    source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + "return __p;\n";
    try {
      render = new Function(settings.variable || "obj", "_", source);
    } catch (e) {
      e.source = source;
      throw e;
    }
    if (data)
      return render(data, _);
    var template = function (data) {
      return render.call(this, data, _);
    };
    template.source = "function(" + (settings.variable || "obj") + "){\n" + source + "}";
    return template;
  };
  _.chain = function (obj) {
    return _(obj).chain();
  };
  var result = function (obj) {
    return this._chain ? _(obj).chain() : obj;
  };
  _.mixin(_);
  each([
    "pop",
    "push",
    "reverse",
    "shift",
    "sort",
    "splice",
    "unshift"
  ], function (name) {
    var method = ArrayProto[name];
    _.prototype[name] = function () {
      var obj = this._wrapped;
      method.apply(obj, arguments);
      if ((name == "shift" || name == "splice") && obj.length === 0)
        delete obj[0];
      return result.call(this, obj);
    };
  });
  each([
    "concat",
    "join",
    "slice"
  ], function (name) {
    var method = ArrayProto[name];
    _.prototype[name] = function () {
      return result.call(this, method.apply(this._wrapped, arguments));
    };
  });
  _.extend(_.prototype, {
    chain: function () {
      this._chain = true;
      return this;
    },
    value: function () {
      return this._wrapped;
    }
  });
  if (typeof define === "function" && define.amd) {
    define("underscore", [], function () {
      return _;
    });
  }
  return _;


}).call(this, require, exports, module);
var __old___0 = window['_'],
    __old___ibm1 = window['_IBM'];
window['_'] = __umodule__;
window['_IBM'] = __umodule__;

__umodule__.noConflict = function () {
  window['_'] = __old___0;
window['_IBM'] = __old___ibm1;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/lib/IBMQ', ['require','exports','module'],function (require, exports, module) {
  var __umodule__ = (function (require, exports, module) {
  

"use strict";
  var hasStacks = false;
  try {
    throw new Error();
  } catch (e) {
    hasStacks = !!e.stack;
  }
  var qStartingLine = captureLine();
  var qFileName;
  var noop = function () {
  };
  var nextTick = function () {
      var head = {
          task: void 0,
          next: null
        };
      var tail = head;
      var flushing = false;
      var requestTick = void 0;
      var isNodeJS = false;
      function flush() {
        while (head.next) {
          head = head.next;
          var task = head.task;
          head.task = void 0;
          var domain = head.domain;
          if (domain) {
            head.domain = void 0;
            domain.enter();
          }
          try {
            task();
          } catch (e) {
            if (isNodeJS) {
              if (domain) {
                domain.exit();
              }
              setTimeout(flush, 0);
              if (domain) {
                domain.enter();
              }
              throw e;
            } else {
              setTimeout(function () {
                throw e;
              }, 0);
            }
          }
          if (domain) {
            domain.exit();
          }
        }
        flushing = false;
      }
      nextTick = function (task) {
        tail = tail.next = {
          task: task,
          domain: isNodeJS && process.domain,
          next: null
        };
        if (!flushing) {
          flushing = true;
          requestTick();
        }
      };
      if (typeof process !== "undefined" && process.nextTick) {
        isNodeJS = true;
        requestTick = function () {
          process.nextTick(flush);
        };
      } else if (typeof setImmediate === "function") {
        if (typeof window !== "undefined") {
          requestTick = setImmediate.bind(window, flush);
        } else {
          requestTick = function () {
            setImmediate(flush);
          };
        }
      } else if (typeof MessageChannel !== "undefined") {
        var channel = new MessageChannel();
        channel.port1.onmessage = function () {
          requestTick = requestPortTick;
          channel.port1.onmessage = flush;
          flush();
        };
        var requestPortTick = function () {
          channel.port2.postMessage(0);
        };
        requestTick = function () {
          setTimeout(flush, 0);
          requestPortTick();
        };
      } else {
        requestTick = function () {
          setTimeout(flush, 0);
        };
      }
      return nextTick;
    }();
  var call = Function.call;
  function uncurryThis(f) {
    return function () {
      return call.apply(f, arguments);
    };
  }
  var array_slice = uncurryThis(Array.prototype.slice);
  var array_reduce = uncurryThis(Array.prototype.reduce || function (callback, basis) {
      var index = 0, length = this.length;
      if (arguments.length === 1) {
        do {
          if (index in this) {
            basis = this[index++];
            break;
          }
          if (++index >= length) {
            throw new TypeError();
          }
        } while (1);
      }
      for (; index < length; index++) {
        if (index in this) {
          basis = callback(basis, this[index], index);
        }
      }
      return basis;
    });
  var array_indexOf = uncurryThis(Array.prototype.indexOf || function (value) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] === value) {
          return i;
        }
      }
      return -1;
    });
  var array_map = uncurryThis(Array.prototype.map || function (callback, thisp) {
      var self = this;
      var collect = [];
      array_reduce(self, function (undefined, value, index) {
        collect.push(callback.call(thisp, value, index, self));
      }, void 0);
      return collect;
    });
  var object_create = Object.create || function (prototype) {
      function Type() {
      }
      Type.prototype = prototype;
      return new Type();
    };
  var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
  var object_keys = Object.keys || function (object) {
      var keys = [];
      for (var key in object) {
        if (object_hasOwnProperty(object, key)) {
          keys.push(key);
        }
      }
      return keys;
    };
  var object_toString = uncurryThis(Object.prototype.toString);
  function isObject(value) {
    return value === Object(value);
  }
  function isStopIteration(exception) {
    return object_toString(exception) === "[object StopIteration]" || exception instanceof QReturnValue;
  }
  var QReturnValue;
  if (typeof ReturnValue !== "undefined") {
    QReturnValue = ReturnValue;
  } else {
    QReturnValue = function (value) {
      this.value = value;
    };
  }
  var hasES6Generators;
  try {
    new Function("(function* (){ yield 1; })");
    hasES6Generators = true;
  } catch (e) {
    hasES6Generators = false;
  }
  var STACK_JUMP_SEPARATOR = "From previous event:";
  function makeStackTraceLong(error, promise) {
    if (hasStacks && promise.stack && typeof error === "object" && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1) {
      var stacks = [];
      for (var p = promise; !!p; p = p.source) {
        if (p.stack) {
          stacks.unshift(p.stack);
        }
      }
      stacks.unshift(error.stack);
      var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
      error.stack = filterStackString(concatedStacks);
    }
  }
  function filterStackString(stackString) {
    var lines = stackString.split("\n");
    var desiredLines = [];
    for (var i = 0; i < lines.length; ++i) {
      var line = lines[i];
      if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
        desiredLines.push(line);
      }
    }
    return desiredLines.join("\n");
  }
  function isNodeFrame(stackLine) {
    return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1;
  }
  function getFileNameAndLineNumber(stackLine) {
    var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
    if (attempt1) {
      return [
        attempt1[1],
        Number(attempt1[2])
      ];
    }
    var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
    if (attempt2) {
      return [
        attempt2[1],
        Number(attempt2[2])
      ];
    }
    var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
    if (attempt3) {
      return [
        attempt3[1],
        Number(attempt3[2])
      ];
    }
  }
  function isInternalFrame(stackLine) {
    var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
    if (!fileNameAndLineNumber) {
      return false;
    }
    var fileName = fileNameAndLineNumber[0];
    var lineNumber = fileNameAndLineNumber[1];
    return fileName === qFileName && lineNumber >= qStartingLine && lineNumber <= qEndingLine;
  }
  function captureLine() {
    if (!hasStacks) {
      return;
    }
    try {
      throw new Error();
    } catch (e) {
      var lines = e.stack.split("\n");
      var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
      var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
      if (!fileNameAndLineNumber) {
        return;
      }
      qFileName = fileNameAndLineNumber[0];
      return fileNameAndLineNumber[1];
    }
  }
  function deprecate(callback, name, alternative) {
    return function () {
      if (typeof console !== "undefined" && typeof console.warn === "function") {
        console.warn(name + " is deprecated, use " + alternative + " instead.", new Error("").stack);
      }
      return callback.apply(callback, arguments);
    };
  }
  function Q(value) {
    if (isPromise(value)) {
      return value;
    }
    if (isPromiseAlike(value)) {
      return coerce(value);
    } else {
      return fulfill(value);
    }
  }
  Q.resolve = Q;
  Q.nextTick = nextTick;
  Q.longStackSupport = false;
  Q.defer = defer;
  function defer() {
    var messages = [], progressListeners = [], resolvedPromise;
    var deferred = object_create(defer.prototype);
    var promise = object_create(Promise.prototype);
    promise.promiseDispatch = function (resolve, op, operands) {
      var args = array_slice(arguments);
      if (messages) {
        messages.push(args);
        if (op === "when" && operands[1]) {
          progressListeners.push(operands[1]);
        }
      } else {
        nextTick(function () {
          resolvedPromise.promiseDispatch.apply(resolvedPromise, args);
        });
      }
    };
    promise.valueOf = deprecate(function () {
      if (messages) {
        return promise;
      }
      var nearerValue = nearer(resolvedPromise);
      if (isPromise(nearerValue)) {
        resolvedPromise = nearerValue;
      }
      return nearerValue;
    }, "valueOf", "inspect");
    promise.inspect = function () {
      if (!resolvedPromise) {
        return { state: "pending" };
      }
      return resolvedPromise.inspect();
    };
    if (Q.longStackSupport && hasStacks) {
      try {
        throw new Error();
      } catch (e) {
        promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
      }
    }
    function become(newPromise) {
      resolvedPromise = newPromise;
      promise.source = newPromise;
      array_reduce(messages, function (undefined, message) {
        nextTick(function () {
          newPromise.promiseDispatch.apply(newPromise, message);
        });
      }, void 0);
      messages = void 0;
      progressListeners = void 0;
    }
    deferred.promise = promise;
    deferred.resolve = function (value) {
      if (resolvedPromise) {
        return;
      }
      become(Q(value));
    };
    deferred.fulfill = function (value) {
      if (resolvedPromise) {
        return;
      }
      become(fulfill(value));
    };
    deferred.reject = function (reason) {
      if (resolvedPromise) {
        return;
      }
      become(reject(reason));
    };
    deferred.notify = function (progress) {
      if (resolvedPromise) {
        return;
      }
      array_reduce(progressListeners, function (undefined, progressListener) {
        nextTick(function () {
          progressListener(progress);
        });
      }, void 0);
    };
    return deferred;
  }
  defer.prototype.makeNodeResolver = function () {
    var self = this;
    return function (error, value) {
      if (error) {
        self.reject(error);
      } else if (arguments.length > 2) {
        self.resolve(array_slice(arguments, 1));
      } else {
        self.resolve(value);
      }
    };
  };
  Q.promise = promise;
  function promise(resolver) {
    if (typeof resolver !== "function") {
      throw new TypeError("resolver must be a function.");
    }
    var deferred = defer();
    try {
      resolver(deferred.resolve, deferred.reject, deferred.notify);
    } catch (reason) {
      deferred.reject(reason);
    }
    return deferred.promise;
  }
  Q.passByCopy = function (object) {
    return object;
  };
  Promise.prototype.passByCopy = function () {
    return this;
  };
  Q.join = function (x, y) {
    return Q(x).join(y);
  };
  Promise.prototype.join = function (that) {
    return Q([
      this,
      that
    ]).spread(function (x, y) {
      if (x === y) {
        return x;
      } else {
        throw new Error("Can't join: not the same: " + x + " " + y);
      }
    });
  };
  Q.race = race;
  function race(answerPs) {
    return promise(function (resolve, reject) {
      for (var i = 0, len = answerPs.length; i < len; i++) {
        Q(answerPs[i]).then(resolve, reject);
      }
    });
  }
  Promise.prototype.race = function () {
    return this.then(Q.race);
  };
  Q.makePromise = Promise;
  function Promise(descriptor, fallback, inspect) {
    if (fallback === void 0) {
      fallback = function (op) {
        return reject(new Error("Promise does not support operation: " + op));
      };
    }
    if (inspect === void 0) {
      inspect = function () {
        return { state: "unknown" };
      };
    }
    var promise = object_create(Promise.prototype);
    promise.promiseDispatch = function (resolve, op, args) {
      var result;
      try {
        if (descriptor[op]) {
          result = descriptor[op].apply(promise, args);
        } else {
          result = fallback.call(promise, op, args);
        }
      } catch (exception) {
        result = reject(exception);
      }
      if (resolve) {
        resolve(result);
      }
    };
    promise.inspect = inspect;
    if (inspect) {
      var inspected = inspect();
      if (inspected.state === "rejected") {
        promise.exception = inspected.reason;
      }
      promise.valueOf = deprecate(function () {
        var inspected = inspect();
        if (inspected.state === "pending" || inspected.state === "rejected") {
          return promise;
        }
        return inspected.value;
      });
    }
    return promise;
  }
  Promise.prototype.toString = function () {
    return "[object Promise]";
  };
  Promise.prototype.then = function (fulfilled, rejected, progressed) {
    var self = this;
    var deferred = defer();
    var done = false;
    function _fulfilled(value) {
      try {
        return typeof fulfilled === "function" ? fulfilled(value) : value;
      } catch (exception) {
        return reject(exception);
      }
    }
    function _rejected(exception) {
      if (typeof rejected === "function") {
        makeStackTraceLong(exception, self);
        try {
          return rejected(exception);
        } catch (newException) {
          return reject(newException);
        }
      }
      return reject(exception);
    }
    function _progressed(value) {
      return typeof progressed === "function" ? progressed(value) : value;
    }
    nextTick(function () {
      self.promiseDispatch(function (value) {
        if (done) {
          return;
        }
        done = true;
        deferred.resolve(_fulfilled(value));
      }, "when", [function (exception) {
          if (done) {
            return;
          }
          done = true;
          deferred.resolve(_rejected(exception));
        }]);
    });
    self.promiseDispatch(void 0, "when", [
      void 0,
      function (value) {
        var newValue;
        var threw = false;
        try {
          newValue = _progressed(value);
        } catch (e) {
          threw = true;
          if (Q.onerror) {
            Q.onerror(e);
          } else {
            throw e;
          }
        }
        if (!threw) {
          deferred.notify(newValue);
        }
      }
    ]);
    return deferred.promise;
  };
  Q.when = when;
  function when(value, fulfilled, rejected, progressed) {
    return Q(value).then(fulfilled, rejected, progressed);
  }
  Promise.prototype.thenResolve = function (value) {
    return this.then(function () {
      return value;
    });
  };
  Q.thenResolve = function (promise, value) {
    return Q(promise).thenResolve(value);
  };
  Promise.prototype.thenReject = function (reason) {
    return this.then(function () {
      throw reason;
    });
  };
  Q.thenReject = function (promise, reason) {
    return Q(promise).thenReject(reason);
  };
  Q.nearer = nearer;
  function nearer(value) {
    if (isPromise(value)) {
      var inspected = value.inspect();
      if (inspected.state === "fulfilled") {
        return inspected.value;
      }
    }
    return value;
  }
  Q.isPromise = isPromise;
  function isPromise(object) {
    return isObject(object) && typeof object.promiseDispatch === "function" && typeof object.inspect === "function";
  }
  Q.isPromiseAlike = isPromiseAlike;
  function isPromiseAlike(object) {
    return isObject(object) && typeof object.then === "function";
  }
  Q.isPending = isPending;
  function isPending(object) {
    return isPromise(object) && object.inspect().state === "pending";
  }
  Promise.prototype.isPending = function () {
    return this.inspect().state === "pending";
  };
  Q.isFulfilled = isFulfilled;
  function isFulfilled(object) {
    return !isPromise(object) || object.inspect().state === "fulfilled";
  }
  Promise.prototype.isFulfilled = function () {
    return this.inspect().state === "fulfilled";
  };
  Q.isRejected = isRejected;
  function isRejected(object) {
    return isPromise(object) && object.inspect().state === "rejected";
  }
  Promise.prototype.isRejected = function () {
    return this.inspect().state === "rejected";
  };
  var unhandledReasons = [];
  var unhandledRejections = [];
  var unhandledReasonsDisplayed = false;
  var trackUnhandledRejections = true;
  function displayUnhandledReasons() {
    if (!unhandledReasonsDisplayed && typeof window !== "undefined" && !window.Touch && window.console) {
      console.warn("[Q] Unhandled rejection reasons (should be empty):", unhandledReasons);
    }
    unhandledReasonsDisplayed = true;
  }
  function logUnhandledReasons() {
    for (var i = 0; i < unhandledReasons.length; i++) {
      var reason = unhandledReasons[i];
      console.warn("Unhandled rejection reason:", reason);
    }
  }
  function resetUnhandledRejections() {
    unhandledReasons.length = 0;
    unhandledRejections.length = 0;
    unhandledReasonsDisplayed = false;
    if (!trackUnhandledRejections) {
      trackUnhandledRejections = true;
      if (typeof process !== "undefined" && process.on) {
        process.on("exit", logUnhandledReasons);
      }
    }
  }
  function trackRejection(promise, reason) {
    if (!trackUnhandledRejections) {
      return;
    }
    unhandledRejections.push(promise);
    if (reason && typeof reason.stack !== "undefined") {
      unhandledReasons.push(reason.stack);
    } else {
      unhandledReasons.push("(no stack) " + reason);
    }
    displayUnhandledReasons();
  }
  function untrackRejection(promise) {
    if (!trackUnhandledRejections) {
      return;
    }
    var at = array_indexOf(unhandledRejections, promise);
    if (at !== -1) {
      unhandledRejections.splice(at, 1);
      unhandledReasons.splice(at, 1);
    }
  }
  Q.resetUnhandledRejections = resetUnhandledRejections;
  Q.getUnhandledReasons = function () {
    return unhandledReasons.slice();
  };
  Q.stopUnhandledRejectionTracking = function () {
    resetUnhandledRejections();
    if (typeof process !== "undefined" && process.on) {
      process.removeListener("exit", logUnhandledReasons);
    }
    trackUnhandledRejections = false;
  };
  resetUnhandledRejections();
  Q.reject = reject;
  function reject(reason) {
    var rejection = Promise({
        "when": function (rejected) {
          if (rejected) {
            untrackRejection(this);
          }
          return rejected ? rejected(reason) : this;
        }
      }, function fallback() {
        return this;
      }, function inspect() {
        return {
          state: "rejected",
          reason: reason
        };
      });
    trackRejection(rejection, reason);
    return rejection;
  }
  Q.fulfill = fulfill;
  function fulfill(value) {
    return Promise({
      "when": function () {
        return value;
      },
      "get": function (name) {
        return value[name];
      },
      "set": function (name, rhs) {
        value[name] = rhs;
      },
      "delete": function (name) {
        delete value[name];
      },
      "post": function (name, args) {
        if (name === null || name === void 0) {
          return value.apply(void 0, args);
        } else {
          return value[name].apply(value, args);
        }
      },
      "apply": function (thisp, args) {
        return value.apply(thisp, args);
      },
      "keys": function () {
        return object_keys(value);
      }
    }, void 0, function inspect() {
      return {
        state: "fulfilled",
        value: value
      };
    });
  }
  function coerce(promise) {
    var deferred = defer();
    nextTick(function () {
      try {
        promise.then(deferred.resolve, deferred.reject, deferred.notify);
      } catch (exception) {
        deferred.reject(exception);
      }
    });
    return deferred.promise;
  }
  Q.master = master;
  function master(object) {
    return Promise({
      "isDef": function () {
      }
    }, function fallback(op, args) {
      return dispatch(object, op, args);
    }, function () {
      return Q(object).inspect();
    });
  }
  Q.spread = spread;
  function spread(value, fulfilled, rejected) {
    return Q(value).spread(fulfilled, rejected);
  }
  Promise.prototype.spread = function (fulfilled, rejected) {
    return this.all().then(function (array) {
      return fulfilled.apply(void 0, array);
    }, rejected);
  };
  Q.async = async;
  function async(makeGenerator) {
    return function () {
      function continuer(verb, arg) {
        var result;
        if (hasES6Generators) {
          try {
            result = generator[verb](arg);
          } catch (exception) {
            return reject(exception);
          }
          if (result.done) {
            return result.value;
          } else {
            return when(result.value, callback, errback);
          }
        } else {
          try {
            result = generator[verb](arg);
          } catch (exception) {
            if (isStopIteration(exception)) {
              return exception.value;
            } else {
              return reject(exception);
            }
          }
          return when(result, callback, errback);
        }
      }
      var generator = makeGenerator.apply(this, arguments);
      var callback = continuer.bind(continuer, "next");
      var errback = continuer.bind(continuer, "throw");
      return callback();
    };
  }
  Q.spawn = spawn;
  function spawn(makeGenerator) {
    Q.done(Q.async(makeGenerator)());
  }
  Q["return"] = _return;
  function _return(value) {
    throw new QReturnValue(value);
  }
  Q.promised = promised;
  function promised(callback) {
    return function () {
      return spread([
        this,
        all(arguments)
      ], function (self, args) {
        return callback.apply(self, args);
      });
    };
  }
  Q.dispatch = dispatch;
  function dispatch(object, op, args) {
    return Q(object).dispatch(op, args);
  }
  Promise.prototype.dispatch = function (op, args) {
    var self = this;
    var deferred = defer();
    nextTick(function () {
      self.promiseDispatch(deferred.resolve, op, args);
    });
    return deferred.promise;
  };
  Q.get = function (object, key) {
    return Q(object).dispatch("get", [key]);
  };
  Promise.prototype.get = function (key) {
    return this.dispatch("get", [key]);
  };
  Q.set = function (object, key, value) {
    return Q(object).dispatch("set", [
      key,
      value
    ]);
  };
  Promise.prototype.set = function (key, value) {
    return this.dispatch("set", [
      key,
      value
    ]);
  };
  Q.del = Q["delete"] = function (object, key) {
    return Q(object).dispatch("delete", [key]);
  };
  Promise.prototype.del = Promise.prototype["delete"] = function (key) {
    return this.dispatch("delete", [key]);
  };
  Q.mapply = Q.post = function (object, name, args) {
    return Q(object).dispatch("post", [
      name,
      args
    ]);
  };
  Promise.prototype.mapply = Promise.prototype.post = function (name, args) {
    return this.dispatch("post", [
      name,
      args
    ]);
  };
  Q.send = Q.mcall = Q.invoke = function (object, name) {
    return Q(object).dispatch("post", [
      name,
      array_slice(arguments, 2)
    ]);
  };
  Promise.prototype.send = Promise.prototype.mcall = Promise.prototype.invoke = function (name) {
    return this.dispatch("post", [
      name,
      array_slice(arguments, 1)
    ]);
  };
  Q.fapply = function (object, args) {
    return Q(object).dispatch("apply", [
      void 0,
      args
    ]);
  };
  Promise.prototype.fapply = function (args) {
    return this.dispatch("apply", [
      void 0,
      args
    ]);
  };
  Q["try"] = Q.fcall = function (object) {
    return Q(object).dispatch("apply", [
      void 0,
      array_slice(arguments, 1)
    ]);
  };
  Promise.prototype.fcall = function () {
    return this.dispatch("apply", [
      void 0,
      array_slice(arguments)
    ]);
  };
  Q.fbind = function (object) {
    var promise = Q(object);
    var args = array_slice(arguments, 1);
    return function fbound() {
      return promise.dispatch("apply", [
        this,
        args.concat(array_slice(arguments))
      ]);
    };
  };
  Promise.prototype.fbind = function () {
    var promise = this;
    var args = array_slice(arguments);
    return function fbound() {
      return promise.dispatch("apply", [
        this,
        args.concat(array_slice(arguments))
      ]);
    };
  };
  Q.keys = function (object) {
    return Q(object).dispatch("keys", []);
  };
  Promise.prototype.keys = function () {
    return this.dispatch("keys", []);
  };
  Q.all = all;
  function all(promises) {
    return when(promises, function (promises) {
      var countDown = 0;
      var deferred = defer();
      array_reduce(promises, function (undefined, promise, index) {
        var snapshot;
        if (isPromise(promise) && (snapshot = promise.inspect()).state === "fulfilled") {
          promises[index] = snapshot.value;
        } else {
          ++countDown;
          when(promise, function (value) {
            promises[index] = value;
            if (--countDown === 0) {
              deferred.resolve(promises);
            }
          }, deferred.reject, function (progress) {
            deferred.notify({
              index: index,
              value: progress
            });
          });
        }
      }, void 0);
      if (countDown === 0) {
        deferred.resolve(promises);
      }
      return deferred.promise;
    });
  }
  Promise.prototype.all = function () {
    return all(this);
  };
  Q.allResolved = deprecate(allResolved, "allResolved", "allSettled");
  function allResolved(promises) {
    return when(promises, function (promises) {
      promises = array_map(promises, Q);
      return when(all(array_map(promises, function (promise) {
        return when(promise, noop, noop);
      })), function () {
        return promises;
      });
    });
  }
  Promise.prototype.allResolved = function () {
    return allResolved(this);
  };
  Q.allSettled = allSettled;
  function allSettled(promises) {
    return Q(promises).allSettled();
  }
  Promise.prototype.allSettled = function () {
    return this.then(function (promises) {
      return all(array_map(promises, function (promise) {
        promise = Q(promise);
        function regardless() {
          return promise.inspect();
        }
        return promise.then(regardless, regardless);
      }));
    });
  };
  Q.fail = Q["catch"] = function (object, rejected) {
    return Q(object).then(void 0, rejected);
  };
  Promise.prototype.fail = Promise.prototype["catch"] = function (rejected) {
    return this.then(void 0, rejected);
  };
  Q.progress = progress;
  function progress(object, progressed) {
    return Q(object).then(void 0, void 0, progressed);
  }
  Promise.prototype.progress = function (progressed) {
    return this.then(void 0, void 0, progressed);
  };
  Q.fin = Q["finally"] = function (object, callback) {
    return Q(object)["finally"](callback);
  };
  Promise.prototype.fin = Promise.prototype["finally"] = function (callback) {
    callback = Q(callback);
    return this.then(function (value) {
      return callback.fcall().then(function () {
        return value;
      });
    }, function (reason) {
      return callback.fcall().then(function () {
        throw reason;
      });
    });
  };
  Q.done = function (object, fulfilled, rejected, progress) {
    return Q(object).done(fulfilled, rejected, progress);
  };
  Promise.prototype.done = function (fulfilled, rejected, progress) {
    var onUnhandledError = function (error) {
      nextTick(function () {
        makeStackTraceLong(error, promise);
        if (Q.onerror) {
          Q.onerror(error);
        } else {
          throw error;
        }
      });
    };
    var promise = fulfilled || rejected || progress ? this.then(fulfilled, rejected, progress) : this;
    if (typeof process === "object" && process && process.domain) {
      onUnhandledError = process.domain.bind(onUnhandledError);
    }
    promise.then(void 0, onUnhandledError);
  };
  Q.timeout = function (object, ms, message) {
    return Q(object).timeout(ms, message);
  };
  Promise.prototype.timeout = function (ms, message) {
    var deferred = defer();
    var timeoutId = setTimeout(function () {
        deferred.reject(new Error(message || "Timed out after " + ms + " ms"));
      }, ms);
    this.then(function (value) {
      clearTimeout(timeoutId);
      deferred.resolve(value);
    }, function (exception) {
      clearTimeout(timeoutId);
      deferred.reject(exception);
    }, deferred.notify);
    return deferred.promise;
  };
  Q.delay = function (object, timeout) {
    if (timeout === void 0) {
      timeout = object;
      object = void 0;
    }
    return Q(object).delay(timeout);
  };
  Promise.prototype.delay = function (timeout) {
    return this.then(function (value) {
      var deferred = defer();
      setTimeout(function () {
        deferred.resolve(value);
      }, timeout);
      return deferred.promise;
    });
  };
  Q.nfapply = function (callback, args) {
    return Q(callback).nfapply(args);
  };
  Promise.prototype.nfapply = function (args) {
    var deferred = defer();
    var nodeArgs = array_slice(args);
    nodeArgs.push(deferred.makeNodeResolver());
    this.fapply(nodeArgs).fail(deferred.reject);
    return deferred.promise;
  };
  Q.nfcall = function (callback) {
    var args = array_slice(arguments, 1);
    return Q(callback).nfapply(args);
  };
  Promise.prototype.nfcall = function () {
    var nodeArgs = array_slice(arguments);
    var deferred = defer();
    nodeArgs.push(deferred.makeNodeResolver());
    this.fapply(nodeArgs).fail(deferred.reject);
    return deferred.promise;
  };
  Q.nfbind = Q.denodeify = function (callback) {
    var baseArgs = array_slice(arguments, 1);
    return function () {
      var nodeArgs = baseArgs.concat(array_slice(arguments));
      var deferred = defer();
      nodeArgs.push(deferred.makeNodeResolver());
      Q(callback).fapply(nodeArgs).fail(deferred.reject);
      return deferred.promise;
    };
  };
  Promise.prototype.nfbind = Promise.prototype.denodeify = function () {
    var args = array_slice(arguments);
    args.unshift(this);
    return Q.denodeify.apply(void 0, args);
  };
  Q.nbind = function (callback, thisp) {
    var baseArgs = array_slice(arguments, 2);
    return function () {
      var nodeArgs = baseArgs.concat(array_slice(arguments));
      var deferred = defer();
      nodeArgs.push(deferred.makeNodeResolver());
      function bound() {
        return callback.apply(thisp, arguments);
      }
      Q(bound).fapply(nodeArgs).fail(deferred.reject);
      return deferred.promise;
    };
  };
  Promise.prototype.nbind = function () {
    var args = array_slice(arguments, 0);
    args.unshift(this);
    return Q.nbind.apply(void 0, args);
  };
  Q.nmapply = Q.npost = function (object, name, args) {
    return Q(object).npost(name, args);
  };
  Promise.prototype.nmapply = Promise.prototype.npost = function (name, args) {
    var nodeArgs = array_slice(args || []);
    var deferred = defer();
    nodeArgs.push(deferred.makeNodeResolver());
    this.dispatch("post", [
      name,
      nodeArgs
    ]).fail(deferred.reject);
    return deferred.promise;
  };
  Q.nsend = Q.nmcall = Q.ninvoke = function (object, name) {
    var nodeArgs = array_slice(arguments, 2);
    var deferred = defer();
    nodeArgs.push(deferred.makeNodeResolver());
    Q(object).dispatch("post", [
      name,
      nodeArgs
    ]).fail(deferred.reject);
    return deferred.promise;
  };
  Promise.prototype.nsend = Promise.prototype.nmcall = Promise.prototype.ninvoke = function (name) {
    var nodeArgs = array_slice(arguments, 1);
    var deferred = defer();
    nodeArgs.push(deferred.makeNodeResolver());
    this.dispatch("post", [
      name,
      nodeArgs
    ]).fail(deferred.reject);
    return deferred.promise;
  };
  Q.nodeify = nodeify;
  function nodeify(object, nodeback) {
    return Q(object).nodeify(nodeback);
  }
  Promise.prototype.nodeify = function (nodeback) {
    if (nodeback) {
      this.then(function (value) {
        nextTick(function () {
          nodeback(null, value);
        });
      }, function (error) {
        nextTick(function () {
          nodeback(error);
        });
      });
    } else {
      return this;
    }
  };
  var qEndingLine = captureLine();
  return Q;


}).call(this, require, exports, module);
var __old__q0 = window['Q'],
    __old___q1 = window['_Q'];
window['Q'] = __umodule__;
window['_Q'] = __umodule__;

__umodule__.noConflict = function () {
  window['Q'] = __old__q0;
window['_Q'] = __old___q1;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/utils/IBMUtils', ['require', 'exports', 'module', '../lib/IBMUnderscore'], function (require, exports, module, _) {
  var __umodule__ = (function (require, exports, module, _) {
  

function generateUUID() {
    var format = [
        8,
        4,
        4,
        4,
        8,
        4
      ], uuid;
    format = format.map(function (digits) {
      var rand = Math.floor(Math.random() * Math.pow(16, digits));
      return rand.toString(16);
    });
    format[2] = "4" + format[2].substr(1);
    format[3] = (parseInt(format[3][0], 16) & 3 | 8).toString(16) + format[3].substr(1);
    uuid = format.join("-");
    return uuid.substr(0, uuid.lastIndexOf("-")) + uuid.substr(uuid.lastIndexOf("-") + 1);
  }
  function replace(str, replaceStrings) {
    var newStr = str;
    str.match(/\$(\w)+/gi).forEach(function (replaceStr) {
      var idx = replaceStr.replace("$", "");
      newStr = newStr.replace(replaceStr, replaceStrings[idx]);
    });
    return newStr;
  }
  function isNode() {
    var cordova = cordova, hasExports = typeof __isNode === "boolean" ? __isNode : typeof exports === "object";
    return hasExports && !cordova;
  }
  function toQueryString(obj) {
    var str = "";
    for (prop in obj) {
      var val = obj[prop];
      if (!_.isUndefined(val) && !_.isNull(val)) {
        str = str + prop + "=" + val + "&";
      }
    }
    return str.substring(0, str.length - 1);
  }
  function hasFields(obj, fields) {
    if (!_.isObject(obj))
      return false;
    if (!_.isArray(fields))
      fields = [fields];
    return fields.every(function (field) {
      var val = obj[field];
      if (_.isNull(val) || _.isUndefined(val)) {
        console.warn("Object %o is missing field: %s", obj, field);
        return false;
      }
      return true;
    });
  }
  function inherit(parent, ctor, properties) {
    var props = properties || {};
    if (!_.isFunction(ctor)) {
      props = ctor;
      ctor = props.constructor;
      delete props.constructor;
    }
    ctor.prototype = Object.create(parent.prototype);
    Object.defineProperty(ctor.prototype, "constructor", {
      enumerable: false,
      value: ctor
    });
    _.extend(ctor.prototype, props);
    return ctor;
  }
  function formatObject(object) {
    var doFormat = function (indent, outputMessage, value) {
      if (typeof value == "string") {
        return "\"" + value + "\"";
      }
      if (typeof value == "function") {
        return "";
      } else if (typeof value == "number" || value instanceof Date) {
        return value;
      } else if (value instanceof Array) {
        var msg = outputMessage + "[";
        var index = 0;
        value.forEach(function (item) {
          if (index++) {
            msg += ",";
          }
          msg += doFormat(indent, "", item);
        });
        msg += "]";
        return msg;
      } else {
        var prefix = "{";
        var suffix = "\n" + indent + "}";
        var msg = outputMessage + prefix;
        var index = 0;
        var keySize = 0;
        indent += "  ";
        for (var key in value) {
          keySize++;
          if (typeof value[key] != "function") {
            if (index++) {
              msg += ",";
            }
            msg += "\n" + indent + "\"" + key + "\": ";
            msg += doFormat(indent, "", value[key]);
          }
        }
        msg += keySize > 0 ? suffix : "}";
        return msg;
      }
    };
    return doFormat("", "", object);
  }
  return {
    replace: replace,
    generateUUID: generateUUID,
    isNode: isNode,
    inherit: inherit,
    hasFields: hasFields,
    toQueryString: toQueryString,
    formatObject: formatObject
  };


}).call(this, require, exports, module, _);
var __old__ibmutils0 = window['IBMUtils'];
window['IBMUtils'] = __umodule__;

__umodule__.noConflict = function () {
  window['IBMUtils'] = __old__ibmutils0;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/utils/IBMError', ['require', 'exports', 'module', '../lib/IBMUnderscore', './IBMUtils'], function (require, exports, module, _, utils) {
  var __umodule__ = (function (require, exports, module, _, utils) {
  

function IBMError(err) {
    var error = err || {};
    if (_.isString(error)) {
      error = { message: err };
    }
    error.message = error.message || "";
    var _error = new Error(error.message);
    if (_error && _error.stack) {
      error.stack = _error.stack;
    }
    Object.keys(error).forEach(function (key) {
      this[key] = error[key];
    }.bind(this));
  }
  IBMError.inherit = function (properties) {
    function createDefaultCtor(name) {
      return function IBMNamedError() {
        IBMError.apply(this, _.toArray(arguments));
        this.name = name;
      };
    }
    var props = properties || {}, ctor;
    if (_.isFunction(props)) {
      ctor = props;
      props = arguments[1] || {};
      props.constructor = ctor;
    } else {
      ctor = props.constructor;
    }
    if (ctor === Object) {
      ctor = props.constructor = createDefaultCtor(props.name || IBMError.name);
    } else if (!props.name) {
      if (ctor.name && ctor.name !== "Object" && ctor.name !== "Function") {
        props.name = ctor.name;
      } else {
        props.name = IBMError.name;
      }
    }
    return utils.inherit(IBMError, ctor, props);
  };
  return utils.inherit(Error, IBMError, {
    name: "IBMError",
    toString: function () {
      return this.name + " - " + this.message;
    }
  });


}).call(this, require, exports, module, _, utils);
var __old__ibmerror0 = window['IBMError'];
window['IBMError'] = __umodule__;

__umodule__.noConflict = function () {
  window['IBMError'] = __old__ibmerror0;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/utils/logger/IBMLoggerLevel', ['require','exports','module'],function (require, exports, module) {
  

var _IBMLoggerLevel = function (weight, name) {
    this.weight = weight;
    this.name = name;
  };
  var levels = new Array(new _IBMLoggerLevel(1000, "ERROR"), new _IBMLoggerLevel(900, "WARN"), new _IBMLoggerLevel(800, "INFO"), new _IBMLoggerLevel(700, "DEBUG"), new _IBMLoggerLevel(600, "VERBOSE"));
  var IBMLoggerLevel = {
      levels: levels,
      getLevel: function (level) {
        var levelName = null;
        if (level && typeof level == "string") {
          levelName = level;
        } else if (typeof level == "object") {
          levelName = level.name;
        }
        return this[levelName.toUpperCase()];
      }
    };
  for (var i = 0; i < levels.length; i++) {
    IBMLoggerLevel[levels[i].name] = levels[i];
  }
  return IBMLoggerLevel;


});
define('ibm/mobile/utils/logger/adapters/IBMDefaultAdapter', ['require', 'exports', 'module', '../../IBMUtils'], function (require, exports, module, utils) {
  

var isNode = utils.isNode();
  var IBMDefaultAdapter = function () {
  };
  IBMDefaultAdapter.prototype.log = function (level, msg) {
    if (level.toUpperCase() == "VERBOSE") {
      console.log("[VERBOSE] " + msg);
    } else {
      var logMsg = "[" + level + "] " + (msg && msg.toString().trim().length > 0 ? msg : "");
      var consoleMethod = level.toLowerCase();
      if (isNode && "DEBUG" == level.toUpperCase()) {
        consoleMethod = "error";
      }
      console[consoleMethod](logMsg);
    }
  };
  IBMDefaultAdapter.prototype.setLevel = function (level) {
    this.level = level;
  };
  IBMDefaultAdapter.prototype.getLevel = function () {
    return this.level;
  };
  return IBMDefaultAdapter;


});
define('ibm/mobile/utils/logger/adapters/IBMWinstonAdapter', ['require','exports','module'],function (require, exports, module) {
  

var IBMWinstonAdapter = function (object) {
    var winston = __nodeRequire("winston");
    var config = {
        transports: [],
        exceptionHandlers: [],
        levels: {
          verbose: 500,
          debug: 600,
          info: 700,
          warn: 800,
          error: 900
        }
      };
    if (object && object.transports) {
      var isWinstonObject = object.hasOwnProperty("log") && object.hasOwnProperty("level") && object.hasOwnProperty("default");
      if (isWinstonObject) {
        Object.keys(winston.default.transports).forEach(function (name) {
          config.transports.push(winston.default.transports[name]);
        });
        Object.keys(winston.default.exceptionHandlers).forEach(function (name) {
          config.transports.push(winston.default.exceptionHandlers[name]);
        });
      } else {
        config.transports = object.transports;
        this.linenumber = object.linenumber;
        this.filename = object.filename;
        this.methodname = object.methodname;
        config.exceptionHandlers = object.exceptionHandlers;
        if (object.levels) {
          config.levels = objects.levels;
        }
      }
    } else {
      config.transports.push(new winston.transports.Console());
    }
    this.logger = new winston.Logger(config);
  };
  function _getCurrentCaller() {
    try {
      var current, next, currentFile;
      var err = new Error();
      Error.prepareStackTrace = function (err, stack) {
        return stack;
      };
      current = err.stack.shift();
      currentFile = current.getFileName();
      while (err.stack.length > 0) {
        next = err.stack.shift();
        if (next.getFileName() != currentFile) {
          return next;
        }
        current = next;
      }
    } catch (err) {
    }
    return undefined;
  }
  IBMWinstonAdapter.prototype.log = function (level, msg) {
    var meta = {};
    if (this.linenumber || this.filename || this.methodname) {
      var caller = _getCurrentCaller();
      if (this.linenumber) {
        meta.line = caller.getLineNumber();
      }
      if (this.filename) {
        meta.file = caller.getFileName();
      }
      if (this.methodname) {
        meta.method = caller.getFunctionName() ? caller.getFunctionName() : "underfined";
      }
    }
    this.logger.log(level.toLowerCase(), msg, meta);
  };
  IBMWinstonAdapter.prototype.setLevel = function (level) {
    this.level = level;
    var self = this;
    Object.keys(this.logger.transports).forEach(function (key) {
      self.logger.transports[key].level = level.name.toLowerCase();
    });
  };
  IBMWinstonAdapter.prototype.getLevel = function () {
    return this.level;
  };
  return IBMWinstonAdapter;


});
define('ibm/mobile/utils/logger/adapters/IBMLog4jsAdapter', ['require','exports','module'],function (require, exports, module) {
  

var Level = function (level, levelStr) {
    this.level = level;
    this.levelStr = levelStr;
  };
  Level.prototype.toString = function () {
    return this.levelStr;
  };
  Level.prototype.isLessThanOrEqualTo = function (otherLevel) {
    if (typeof otherLevel === "string") {
      otherLevel = toLevel(otherLevel);
    }
    return this.level <= otherLevel.level;
  };
  Level.prototype.isGreaterThanOrEqualTo = function (otherLevel) {
    if (typeof otherLevel === "string") {
      otherLevel = toLevel(otherLevel);
    }
    return this.level >= otherLevel.level;
  };
  Level.prototype.isEqualTo = function (otherLevel) {
    if (typeof otherLevel == "string") {
      otherLevel = toLevel(otherLevel);
    }
    return this.level === otherLevel.level;
  };
  var IBMLog4jsAdapter = function () {
    var args = Array.prototype.slice.call(arguments);
    var object = args[0];
    var options = {};
    var category = null;
    if (arguments.length == 2) {
      category = args[1];
    } else {
      options = args[1];
      category = args[2];
    }
    var log4js = __nodeRequire("log4js");
    log4js.levels.TRACE = new Level(5000, "VERBOSE");
    var isLog4jsInstance = object.hasOwnProperty("getLogger") && object.hasOwnProperty("getDefaultLogger") && object.hasOwnProperty("addAppender");
    if (isLog4jsInstance) {
      this.logger = log4js.getDefaultLogger();
    } else {
      for (var index in object.appenders) {
        if (object.appenders[index].layout && object.appenders[index].layout.pattern) {
          var pattern = object.appenders[index].layout.pattern;
          object.appenders[index].layout.pattern = pattern.replace(/%F/g, "%x{__FILENAME__}").replace(/%M/g, "%x{__FUNCTIONNAME__}").replace(/%L/g, "%x{__LINENUMBER__}");
          if (!object.appenders[index].layout.tokens) {
            object.appenders[index].layout.tokens = {};
          }
          object.appenders[index].layout.tokens["__FILENAME__"] = function () {
            var err = new Error();
            Error.prepareStackTrace = function (err, stack) {
              return stack;
            };
            var caller = err.stack[err.stack.length - 1];
            return caller.getFileName();
          };
          object.appenders[index].layout.tokens["__FUNCTIONNAME__"] = function () {
            var err = new Error();
            Error.prepareStackTrace = function (err, stack) {
              return stack;
            };
            var caller = err.stack[err.stack.length - 1];
            var funcName = caller.getFunctionName();
            return funcName ? funcName : "undefined";
          };
          object.appenders[index].layout.tokens["__LINENUMBER__"] = function () {
            var err = new Error();
            Error.prepareStackTrace = function (err, stack) {
              return stack;
            };
            var caller = err.stack[err.stack.length - 1];
            return caller.getLineNumber();
          };
        }
      }
      log4js.configure(object, options);
      this.logger = log4js.getLogger(category);
    }
  };
  IBMLog4jsAdapter.prototype.log = function (level, msg, caller) {
    if (level.toUpperCase() == "VERBOSE") {
      this.logger.log("trace", msg);
    } else {
      this.logger.log(level.toLowerCase(), msg);
    }
  };
  IBMLog4jsAdapter.prototype.setLevel = function (level) {
    this.level = level;
    if (level.name.toUpperCase() == "VERBOSE") {
      this.logger.setLevel("TRACE");
    } else {
      this.logger.setLevel(level.name.toUpperCase());
    }
  };
  IBMLog4jsAdapter.prototype.getLevel = function () {
    return this.level;
  };
  return IBMLog4jsAdapter;


});
define('ibm/mobile/utils/IBMLogger', ['require', 'exports', 'module', '../lib/IBMUnderscore', '../lib/IBMQ', './IBMUtils', './logger/IBMLoggerLevel', './logger/adapters/IBMDefaultAdapter', './logger/adapters/IBMWinstonAdapter', './logger/adapters/IBMLog4jsAdapter'], function (require, exports, module, _, Q, IBMUtils, IBMLoggerLevel, IBMDefaultAdapter, IBMWinstonAdapter, IBMLog4jsAdapter) {
  var __umodule__ = (function (require, exports, module, _, Q, IBMUtils, IBMLoggerLevel, IBMDefaultAdapter, IBMWinstonAdapter, IBMLog4jsAdapter) {
  

var isNode = IBMUtils.isNode();
  var IBMLogger = function (object, options, category) {
    this.adapter = new IBMDefaultAdapter();
    if (isNode) {
      var args = Array.prototype.slice.call(arguments);
      var object = args[0];
      var adapterClass = IBMDefaultAdapter;
      if (object && object.transports) {
        adapterClass = IBMWinstonAdapter;
      } else if (object && object.appenders) {
        adapterClass = IBMLog4jsAdapter;
      }
      this.adapter = new (Function.prototype.bind.apply(adapterClass, [null].concat(args)))();
    }
    this.adapter.setLevel(IBMLoggerLevel.INFO);
  };
  IBMLoggerLevel.levels.forEach(function (level) {
    IBMLogger.prototype[level.name.toLowerCase()] = function () {
      if (level.weight >= this.adapter.getLevel().weight) {
        var args = Array.prototype.slice.call(arguments);
        var logMsg = "";
        args.forEach(function (logobj) {
          logMsg = logMsg == "" ? logMsg : logMsg + " ";
          logMsg += typeof logobj == "object" ? IBMUtils.formatObject(logobj) : logobj;
        });
        this.adapter.log(level.name, logMsg);
      }
    };
  });
  IBMLogger.prototype.setLevel = function (level) {
    var l = IBMLoggerLevel.getLevel(level);
    if (l) {
      this.adapter.setLevel(l);
    } else {
      throw new Error("IBMLogger does not support log level:" + level);
    }
  };
  IBMLogger.prototype.getLevel = function () {
    return this.adapter.getLevel();
  };
  return {
    getLogger: function () {
      if (isNode) {
        var args = Array.prototype.slice.call(arguments);
        var f = Function.prototype.bind.apply(IBMLogger, [null].concat(args));
        return new f();
      } else {
        return new IBMLogger();
      }
    }
  };


}).call(this, require, exports, module, _, Q, IBMUtils, IBMLoggerLevel, IBMDefaultAdapter, IBMWinstonAdapter, IBMLog4jsAdapter);
var __old__ibmlogger0 = window['IBMLogger'];
window['IBMLogger'] = __umodule__;

__umodule__.noConflict = function () {
  window['IBMLogger'] = __old__ibmlogger0;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/utils/IBMUriBuilder', ['require','exports','module'],function (require, exports, module) {
  var __umodule__ = (function (require, exports, module) {
  

"use strict";
  function IBMUriBuilder(string) {
    if (!(this instanceof IBMUriBuilder)) {
      throw new TypeError("IBMUriBuilder constructor cannot be called as a function.");
    }
    if (string !== undefined) {
      this._uri = string;
    }
    return this;
  }
  ;
  IBMUriBuilder.prototype = {
    _uri: "",
    constructor: IBMUriBuilder,
    append: function (segment) {
      if (segment.indexOf("/") === 0) {
        segment = segment.substr(1);
      }
      if (this._uri.substr(-1) === "/") {
        this._uri += segment;
      } else {
        this._uri += "/" + segment;
      }
      return this;
    },
    slash: function () {
      if (this._uri.substr(-1) !== "/") {
        this._uri += "/";
      }
      return this;
    }
  };
  IBMUriBuilder.prototype.toString = function () {
    return this._uri;
  };
  return IBMUriBuilder;


}).call(this, require, exports, module);
var __old__ibmuri_builder0 = window['IBMUriBuilder'];
window['IBMUriBuilder'] = __umodule__;

__umodule__.noConflict = function () {
  window['IBMUriBuilder'] = __old__ibmuri_builder0;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/core/IBMCurrentUser', ['require', 'exports', 'module', '../lib/IBMUnderscore'], function (require, exports, module, _) {
  

function IBMCurrentUser(userInfo) {
    var validFields = _.keys(IBMCurrentUser.prototype), fieldsToSet = _.chain(userInfo).keys().intersection(validFields).value();
    fieldsToSet.forEach(function (field) {
      this[field] = userInfo[field];
    }.bind(this));
  }
  IBMCurrentUser.prototype = {
    uuid: null,
    securityProvider: null,
    securityToken: null,
    isVerified: false
  };
  return IBMCurrentUser;


});
define('ibm/mobile/core/IBMCurrentDevice', ['require', 'exports', 'module', '../lib/IBMUnderscore', '../utils/IBMLogger', '../utils/IBMUtils'], function (require, exports, module, _, IBMLogger, utils) {
  

var logger = IBMLogger.getLogger();
  var DEVICES = {};
  DEVICES.PLATFORM = {
    NODE: "NODE",
    WEB: "WEB",
    HYBRID: "HYBRID"
  };
  DEVICES.PLATFORM_VERSION = {
    NODE: "Node Version: $version",
    WEB: "OS: $platform"
  };
  DEVICES.DEVICE_NAME = {
    NODE: "Node $version, Platform: $platform, Arch: $arch",
    WEB: "Vendor: $vendor, Browser: $browser"
  };
  function WebDeviceInfo() {
    var nav = navigator || window["navigator"] || {}, platformInfo = {
        platform: nav.platform,
        vendor: nav.vendor,
        browser: nav.appVersion
      };
    if (_.isEmpty(nav)) {
      logger.error("Unable to access browser's navigator object");
    }
    return {
      hardwareId: utils.generateUUID(),
      model: nav.userAgent,
      platform: DEVICES.PLATFORM.WEB,
      platformVersion: utils.replace(DEVICES.PLATFORM_VERSION.WEB, platformInfo),
      name: utils.replace(DEVICES.DEVICE_NAME.WEB, platformInfo)
    };
  }
  function NodeDeviceInfo() {
    var proc = process || {}, plaformInfo = {
        version: proc.version,
        arch: proc.arch,
        platform: proc.platform
      };
    return {
      hardwareId: utils.generateUUID(),
      model: proc.platform,
      platform: DEVICES.PLATFORM.NODE,
      platformVersion: utils.replace(DEVICES.PLATFORM_VERSION.NODE, plaformInfo),
      name: utils.replace(DEVICES.DEVICE_NAME.NODE, plaformInfo)
    };
  }
  function IBMCurrentDevice(deviceInfo) {
    var validFields = _.keys(IBMCurrentDevice.prototype), fieldsToSet = _.chain(deviceInfo).keys().intersection(validFields).value();
    fieldsToSet.forEach(function (field) {
      this[field] = deviceInfo[field];
    }.bind(this));
  }
  IBMCurrentDevice.getDevice = function () {
    if (!IBMCurrentDevice.device) {
      IBMCurrentDevice.device = new IBMCurrentDevice(utils.isNode() ? NodeDeviceInfo() : WebDeviceInfo());
    }
    return IBMCurrentDevice.device;
  };
  IBMCurrentDevice.DEVICES = DEVICES;
  IBMCurrentDevice.prototype = {
    hardwareId: null,
    model: null,
    platform: null,
    platformVersion: null,
    name: null,
    currentLocation: null,
    uuid: null,
    toString: function () {
      return _.pairs(this).map(function (pair) {
        var key = pair[0], val = pair[1];
        return key + ": " + val;
      }).join(", ");
    }
  };
  return IBMCurrentDevice;


});
define('ibm/mobile/_IBMBluemix', ['require', 'exports', 'module', './lib/IBMUnderscore', './lib/IBMQ', './utils/IBMError', './utils/IBMLogger', './utils/IBMUriBuilder', './utils/IBMUtils', './core/IBMCurrentUser', './core/IBMCurrentDevice'], function (require, exports, module, _, Q, error, ibmLogger) {
  

var logger = ibmLogger.getLogger();
  var _IBMBluemix = {
      VERSION: "1.0.0.20140718-1253",
      config: {},
      initialize: function (config) {
        logger.debug("IBMBluemix: initializing version: " + this.getVersion());
        return this._init.apply(this, _.toArray(arguments));
      },
      _init: function () {
        return Q.reject("_IBMBluemix._init() unimplemented");
      },
      getConfig: function () {
        return Q.reject("_IBMBluemix.getConfig() unimplemented");
      },
      getVersion: function () {
        return this.VERSION;
      },
      getLogger: function () {
        return ibmLogger.getLogger.apply(ibmLogger, arguments);
      }
    };
  return _IBMBluemix;


});
define('cordova',[],function () {
  if (__isNode) {
  return __nodeRequire('cordova');
} else {
  return (typeof cordova !== 'undefined') ? cordova : __nodeRequire('cordova')
}
});
define('cordova/exec',[],function () {
  if (__isNode) {
  return __nodeRequire('cordova/exec');
} else {
  return (typeof exec !== 'undefined') ? exec : __nodeRequire('cordova/exec')
}
});
define('ibm/mobile/utils/IBMHybrid', ['require', 'exports', 'module', '../lib/IBMUnderscore', '../lib/IBMQ', './IBMLogger', 'cordova', 'cordova/exec'], function (require, exports, module, _, Q, ibmLogger) {
  var __umodule__ = (function (require, exports, module, _, Q, ibmLogger) {
  

var logger = ibmLogger.getLogger();
  var exec = null;
  var cordova = null;
  try {
    cordova = require("cordova");
  } catch (e) {
    logger.warn(e.message);
  }
  if (!_.isUndefined(cordova) && !_.isNull(cordova)) {
    if (cordova && !_.isNull(cordova) && !_.isUndefined(cordova)) {
      exec = require("cordova/exec");
    } else {
      logger.warn("The IBM Bluemix Hybrid SDK is trying to load but IBM Worklight does not appear to be initialised");
      return null;
    }
  }
  if (!exec) {
    var message = "The IBM Bluemix Hybrid SDK cannot not establish a bridge to cordova, so cannot continue";
    throw error(message);
  }
  function IBMHybrid(pluginName) {
    if (!(this instanceof IBMHybrid)) {
      throw new Error("IBMHybrid constructor cannot be called as a function.");
    }
    if (!_.isString(pluginName)) {
      throw new Error("IBMHybrid Plugin Name has not been supplied on Initialization");
    }
    this.pluginName = pluginName;
    return this;
  }
  ;
  IBMHybrid.prototype = {
    constructor: IBMHybrid,
    pluginName: null,
    _exec: exec,
    exec: function (method, args) {
      var defer = Q.defer();
      if (!this.pluginName) {
        logger.warn("No pluginName has been set so cannot call Cordova");
        return;
      }
      if (!_.isString(method)) {
        logger.warn("No method has been supplied so cannot call Cordova");
        return;
      }
      this._exec(function (response) {
        defer.resolve(response);
      }, function (error) {
        defer.reject(error);
      }, this.pluginName, method, args);
      logger.info("Hybrid " + method + " " + JSON.stringify(args));
      return defer.promise;
    }
  };
  return IBMHybrid;


}).call(this, require, exports, module, _, Q, ibmLogger);
var __old__ibmhybrid0 = window['IBMHybrid'];
window['IBMHybrid'] = __umodule__;

__umodule__.noConflict = function () {
  window['IBMHybrid'] = __old__ibmhybrid0;
return __umodule__;
};
return __umodule__;
});
define('ibm/mobile/IBMBluemixHybrid', ['require', 'exports', 'module', './lib/IBMUnderscore', './lib/IBMQ', './_IBMBluemix', './utils/IBMHybrid', './utils/IBMLogger', './core/IBMCurrentDevice', './core/IBMCurrentUser'], function (require, exports, module, _, Q, _IBMBluemix, IBMHybrid, IBMLogger, IBMCurrentDevice, IBMCurrentUser) {
  

var CLIENT_PLATFORM_TYPE = "HYBRID";
  var logger = IBMLogger.getLogger();
  var IBMBluemixHybrid = _.extend({}, _IBMBluemix, {
      hybrid: null,
      _init: function (config) {
        var defer = Q.defer();
        this.hybrid = new IBMHybrid("IBMBluemixHybrid");
        if (!config || !_.isObject(config)) {
          defer.reject("initialize needs a valid configuration");
          return defer.promise;
        }
        config = _.clone(config);
        this._validateConfig(config, defer);
        var promise = this.hybrid.exec("initialize", [
            config.applicationId,
            config.applicationSecret,
            config.applicationRoute
          ]);
        defer.resolve(promise);
        return defer.promise;
      },
      _validateConfig: function (config, defer) {
        var missingOptions = _.values(this.RequiredConfigOptions).filter(function (option) {
            var hasRequiredOption = _.has(config, option) && !_.isEmpty(config[option]);
            if (!hasRequiredOption) {
              return option;
            }
          });
        if (missingOptions.length > 0) {
          var errMsg = "Missing required config options: " + missingOptions.join(", ");
          logger.error(errMsg);
          defer.reject(errMsg);
        }
      },
      RequiredConfigOptions: {
        APPLICATION_ID: "applicationId",
        APPLICATION_SECRET: "applicationSecret",
        APPLICATION_ROUTE: "applicationRoute"
      },
      getConfig: function () {
        return this.hybrid.exec("getConfig", []);
      },
      setSecurityToken: function (token, provider) {
        var defer = Q.defer();
        if (!_.isString(provider)) {
          defer.reject("Invalid provider property");
          return defer.promise;
        }
        if (!_.isString(token)) {
          defer.reject("Invalid token property");
          return defer.promise;
        }
        return this.hybrid.exec("setSecurityToken", [
          token,
          provider
        ]);
      },
      clearSecurityToken: function () {
        return this.hybrid.exec("clearSecurityToken", []);
      },
      getCurrentUser: function () {
        var defer = Q.defer();
        this.hybrid.exec("currentUser", []).done(function (user) {
          logger.info(user);
          var currentUser = null;
          if (user) {
            var currentUser = new IBMCurrentUser(user);
          } else {
            defer.reject(null);
          }
          if (currentUser) {
            defer.resolve(currentUser);
          } else {
            defer.reject(null);
          }
        });
        return defer.promise;
      },
      getCurrentDevice: function () {
        var defer = Q.defer();
        this.hybrid.exec("currentDevice", []).done(function (device) {
          logger.info(device);
          var currentDevice = null;
          if (device) {
            var currentDevice = new IBMCurrentDevice(device);
          } else {
            defer.reject(null);
          }
          if (currentDevice) {
            defer.resolve(currentDevice);
          } else {
            defer.reject(null);
          }
        });
        return defer.promise;
      }
    });
  IBMBluemixHybrid.SecurityProvider = Object.freeze({
    GOOGLE: "GOOGLE",
    WORKLIGHT: "WORKLIGHT"
  });
  module.exports = IBMBluemixHybrid;
  return IBMBluemixHybrid;


});
    return require('ibm/mobile/IBMBluemixHybrid');
  };
if (__isAMD) {
  return define(['cordova', 'cordova/exec'], bundleFactory);
} else {
    if (__isNode) {
        return module.exports = bundleFactory(require('cordova'), require('cordova/exec'));
    } else {
        return bundleFactory((typeof cordova !== 'undefined') ? cordova : void 0, (typeof exec !== 'undefined') ? exec : void 0);
    }
}
}).call(this, (typeof exports === 'object' ? global : window),
              (typeof exports === 'object' ? global : window))
